package com.wangkm.roomdemo

import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity
import android.arch.persistence.room.Ignore
import android.arch.persistence.room.PrimaryKey

/**
 * @author: created by wangkm
 * @Time: 2020/9/15 11:47
 * @Des： $
 * @Email: 1240413544@qq.com
 */
@Entity(tableName = "user", indices = [])
class User {
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "uid")
    var uid = 0
    @ColumnInfo(name = "first_name")
    var firstName: String? = null
    @ColumnInfo(name = "last_name")
    var lastName: String? = null
    @ColumnInfo(name = "age")
    var age = 0

    // Getters and setters are ignored for brevity,
// but they're required for Room to work.
    constructor() {}

    @Ignore
    constructor(firstName: String?, lastName: String?) {
        this.firstName = firstName
        this.lastName = lastName
    }

    @Ignore
    constructor(uid: Int) {
        this.uid = uid
    }

    @Ignore
    constructor(uid: Int, firstName: String?, lastName: String?) {
        this.uid = uid
        this.firstName = firstName
        this.lastName = lastName
    }

    @Ignore
    constructor(firstName: String?, lastName: String?, age: Int) {
        this.firstName = firstName
        this.lastName = lastName
        this.age = age
    }

    @Ignore
    constructor(uid: Int, firstName: String?, lastName: String?, age: Int) {
        this.uid = uid
        this.firstName = firstName
        this.lastName = lastName
        this.age = age
    }

    override fun toString(): String {
        return "User{" +
                "uid=" + uid +
                ", firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                ", age='" + age + '\'' +
                '}'
    }
}